{include file=header.html} 
<script type="text/javascript" src="{lib file=mobile/cart.js}" charset="utf-8"></script>
<script type="text/javascript">
$(function(){
	$('#selected-store strong').html($('#cart'+$('input:radio:checked').val()+'_amount').html());
	$('input:radio').change(function(){
		$('#selected-store strong').html($('#cart'+$(this).val()+'_amount').html());
	})
	
	$('.edit').click(function(){
		var text = $(this).text();
		var id = $(this).attr('id');
		if(text == '编辑')
		{
			$(this).text('完成');
		}
		else
		{
			$(this).text('编辑');
			$(".cart-it-"+id+" ul li").each(function(){
				var v = $(this).find("input").val();
				$(this).find("[ectype='quantity']").text(v);	
			})
		}
		
		$(".cart-it-"+id+" ul li").find('.detail').toggle();
	})
})
function go2order()
{
	window.location.href='{$real_site_url}/index.php?app=order&goods=cart&store_id='+$('input:radio:checked').val();
}
</script>
<div id="main">
  <div id="page-cart" class="page-cart page-body">
  	  <!--{foreach from=$carts item=cart key=store_id name=fe_carts}-->
      <div class="cart-it mt10 cart-it-{$store_id}">
        <div class="store-info">
          <div class="info clearfix">
              <h3><input class="rebuild-checkbox"  name="store_id" type="radio"  id="{$store_id}" {if $smarty.foreach.fe_carts.first}checked="checked"{/if} value="{$store_id}"/><label for="{$store_id}"><ins>&#xe676;</ins><a href="{url app=store&id=$store_id}">{$cart.store_name|escape}</a></label></span><span class="ml20 hidden">{$lang.goods_amount}:&nbsp;&nbsp;<strong  id="cart{$store_id}_amount">{$cart.amount|price}</strong></h3>      
              <p class="float-right edit" id="{$store_id}">编辑</p>
          </div>
        </div>
        <ul>
          <!--{foreach from=$cart.goods item=goods name=fe_goods}-->
          <li id="cart_item_{$goods.rec_id}">
            <div class="it clearfix relative"> 
              <a  href="{url app=goods&id=$goods.goods_id}" class="pic"><img src="{$goods.goods_image}"  width="100" height="100" alt="{$goods.goods_name|escape}" /></a>
              <div class="detail"> 
                <div class="attr">
                    <a href="{url app=goods&id=$goods.goods_id}" class="desc">
                        <h4>{$goods.goods_name|escape}</h4>
                    </a>
                    <p class="props">{$goods.specification|escape}</p>
                </div>
                <div class="price clearfix"> 
                    <em class="J_ItemPrice-{$goods.rec_id} float-left">{$goods.price|price}</em>  
                    <ins class="float-right">x<i ectype="quantity">{$goods.quantity}</i></ins>    
                </div>
              </div>
              <div class="hidden detail hidden-part">
                 <span class="quantity-handle block">
                    <i onclick="decrease_quantity({$goods.rec_id});"  style="left:0px;"><ins></ins></i><input id="input_item_{$goods.rec_id}" type="text" value="{$goods.quantity}" orig="{$goods.quantity}" changed="{$goods.quantity}" onkeyup="change_quantity({$store_id}, {$goods.rec_id}, {$goods.spec_id}, this);" /><i onclick="add_quantity({$goods.rec_id});" style="right:44px;" class="add"><ins></ins></i>
                 </span>
                 <p class="mt10 ml10 props">{$goods.specification|escape}</p>
                 <a class="del" href="javascript:drop_cart_item({$store_id}, {$goods.rec_id});" onclick="javascript:return confirm('{$lang.drop_confirm}');">{$lang.drop}</a> 
              </div>
            </div>
          </li>
          <!--{/foreach}-->
        </ul>
       </div>
  	   <!--{/foreach}-->
      <div class="go2order clearfix">
      	<p class="float-left ml10 pt5 pb5" id="selected-store"><b>{$lang.goods_amount}{$lang.colon}<strong>{$cart.amount|price}</strong></b><span>（不含运费）</span></p>
        <a  href="javascript:;"  onclick="go2order();"  class="btn float-right">去结算</a> 
      </div>
  </div>
</div>
{include file=footer.html} 